package org.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.controller.ErpDepotController;
import org.apache.ibatis.annotations.Param;
import org.example.domain.dto.ErpDepotItemDTO;
import org.example.domain.po.ErpDepotItem;
import org.example.domain.vo.ErpDepotItemVO;
import org.example.service.ErpDepotItemService;
import org.example.mapper.ErpDepotItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 24059
 * @description 针对表【erp_depot_item(单据子表)】的数据库操作Service实现
 * @createDate 2024-10-18 15:32:31
 */
@Service
public class ErpDepotItemServiceImpl extends ServiceImpl<ErpDepotItemMapper, ErpDepotItem>
        implements ErpDepotItemService{
    @Autowired
    ErpDepotItemMapper erpDepotItemMapper ;
    @Override
    public int insert(ErpDepotItemDTO erpDepotItem){
        return baseMapper.insert(erpDepotItem);
    }
    public int updateDepotItem(ErpDepotItemDTO erpDepotItem, Long headerId){
        return baseMapper.updateDepotItem(erpDepotItem,headerId);
    }
    public List<ErpDepotItem> selectByPrimaryKey(@Param("headerId") Long headerId){
        return baseMapper.selectByPrimaryKey(headerId);
    }


    @Override
    public int insert(ErpDepotItem erpDepotItem) {
        return 0;
    }

    @Override
    public List<ErpDepotItemVO> look(Integer id) {
        return baseMapper.look(id);
    }

    public int insertdepot(ErpDepotItemDTO erpDepotItem){
        return baseMapper.insertdepot(erpDepotItem);
    }

    public Long lookByHeaderherdId(Long headerId) {
        return baseMapper.lookByHeaderherdId(headerId);
    }

    public Long lookByHeaderlinkId(List<Long> linkId) {

        return baseMapper.lookByHeaderlinkId(linkId);
    }
    public List<ErpDepotItem>lookByitemid(@Param("headerId") Long headerId){
        return baseMapper.lookByitemid(headerId);
    }
    public List<Long> lookByitemidnumvber(@Param("number") String number){
        return baseMapper.lookByitemidnumvber(number);
    }
    @Override
    public List<ErpDepotItemVO> findById(Integer id, Long tenantId) {
        return baseMapper.findById(id,tenantId);
    }

    @Override
    public List<ErpDepotItemVO> findItems(Long headerId) {
        return baseMapper.findItems(headerId);
    }
    @Override
    public List<ErpDepotItemVO> findItem(Long headerId) {
        return baseMapper.findItem(headerId);
    }

    // 添加删除方法

    // 添加删除方法

    // 实现删除扩展信息的方法
    @Override
    @Transactional // 添加事务管理
    public boolean deleteItem(Long headerId) {
        return baseMapper.deleteItem(headerId) > 0;
    }

}




